import { http } from '@/utils/http'

// 新增
export const appAdd = (data?: object) => {
  return http.post('/app/app', { data })
}

// 编辑
export const costMgtUpdate = (data?: object) => {
  return http.post('/app/update', { data })
}

// 列表
export const getList = (params?: object) => {
  return http.get<{}, HttpPaginationResponse<Array<ApiListItem>>>('/manage/apiInfo/apis', {
    params,
  })
}

// 详情信息
export const getDetail = (params?: number) => {
  return http.get<{}, HttpResponse>('/manage/approve/apiApplyInfo', {
    params: { applyId: params },
  })
}

// 删除
export const deleteApp = (params?: object) => {
  return http.request('delete', `/app/${params}`)
}

// 接口审批
export const approve = (params?: object) => {
  return http.request('put', '/manage/approve/approve', { params })
}

export type ApiListItem = {
  id: string
  apiName: string
  requestPath: string
  apiType: string
  apiCatalog: string
  apiIntro: string
  apiDesc: string
  apiIconPth: string
  algorithmBasic: string
  version: string
  checkStatus: string
  enabledStatus: string
  publishTime: string
  checkTime: string
  updateTime: string
  callFreq: number
}
